#include<iostream>
#include<vector>
using namespace std;
class Solution 
{
    vector<vector<int>>  ret;
    vector<int> path;
    bool st[21];
public:
    vector<vector<int>> permute(vector<int>& nums) 
    {
        dfs(nums);
        return ret;
    }
    void dfs(vector<int>&nums)
    {
        if(path.size()==nums.size())
        {
            ret.push_back(path);
            return;
        }
        for(int i=0;i<nums.size();i++)
        {
            if(st[nums[i]+10]==false)
            {
                path.push_back(nums[i]);
                st[nums[i]+10]=true;
                dfs(nums);
                st[nums[i]+10]=false;
                path.pop_back();
            }
        }
    }
};